WPS Office.apk(点击下载) / T.java


package com.iflytek.cloud.thirdparty;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.SystemClock;
import android.telephony.TelephonyManager;
import android.telephony.cdma.CdmaCellLocation;
import android.telephony.gsm.GsmCellLocation;
import android.text.TextUtils;
import com.iflytek.cloud.ErrorCode;
import com.iflytek.cloud.Setting;
import com.iflytek.cloud.SpeechConstant;
import com.iflytek.cloud.SpeechError;
import com.iflytek.cloud.SpeechUtility;
import com.iflytek.cloud.Version;
import com.iflytek.cloud.util.AudioDetector;
import com.mopub.common.AdType;

public class T {
    private static String a = "xiaoyan";
    private static String b = null;

    public static int a(AbstractHandlerC0273s sVar) {
        return (sVar == null || !sVar.m()) ? 4000 : 5000;
    }

    public static String a() {
        return SpeechUtility.getUtility().getParameter("appid");
    }

    public static String a(Context context) {
        if (context == null) {
            return "null";
        }
        R a2 = D.a(context);
        String str = a2.e("os.imsi") + "|" + a2.e("os.imei");
        if (str.length() < 10) {
            str = a2.e("net.mac");
        }
        if (TextUtils.isEmpty(str) || str.length() <= 0) {
            return null;
        }
        return str;
    }

    public static String a(Context context, AbstractHandlerC0273s sVar) throws SpeechError {
        if (context == null) {
            throw new SpeechError((int) ErrorCode.ERROR_INVALID_PARAM);
        }
        R b2 = sVar.x().clone();
        b = b2.b(SpeechConstant.NET_TYPE, b);
        a(context, b2);
        b2.a("timeout", "20000", false);
        b2.a("auth", "1", false);
        b2.a("msc.ver", Version.getVersion());
        b2.a("mac", D.a(context).e("net.mac"), false);
        b2.a("dvc", a(context), false);
        b2.a("unique_id", N.a(context));
        b2.a("msc.lat", new StringBuilder().append(E.a(context).a("msc.lat")).toString(), false);
        b2.a("msc.lng", new StringBuilder().append(E.a(context).a("msc.lng")).toString(), false);
        b2.a(D.b(context));
        a(b2);
        b(context, b2);
        b2.a(S.c);
        return b2.toString();
    }

    public static String a(Context context, String str, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        b2.c(SpeechConstant.CLOUD_GRAMMAR);
        a(context, b2);
        b(context, b2);
        b2.a(SpeechConstant.LANGUAGE, "zh_cn", false);
        b2.a(SpeechConstant.ACCENT, "mandarin", false);
        b2.a(SpeechConstant.RESULT_TYPE, AdType.STATIC_NATIVE, false);
        b2.a("rse", sVar.s(), false);
        b2.a(SpeechConstant.TEXT_ENCODING, sVar.r(), false);
        b2.a("ssm", "1", false);
        b2.a("msc.skin", "0", false);
        if (TextUtils.isEmpty(str)) {
            b2.a(SpeechConstant.SUBJECT, "iat", false);
        } else {
            b2.a(SpeechConstant.SUBJECT, "asr", false);
        }
        int t = sVar.t();
        b2.a("auf=audio/L16;rate", Integer.toString(t), false);
        if (t == 16000) {
            b2.a("aue", "speex-wb", false);
        } else {
            b2.a("aue", "speex", false);
        }
        b2.a(SpeechConstant.VAD_BOS, Integer.toString(a(sVar)), false);
        b2.a(SpeechConstant.VAD_EOS, Integer.toString(b(sVar)), false);
        b2.a(S.c);
        return b2.toString();
    }

    public static void a(Context context, R r) {
        if (TextUtils.isEmpty(r.e(SpeechConstant.NET_TYPE)) && !TextUtils.isEmpty(b)) {
            r.a(SpeechConstant.NET_TYPE, b, false);
        } else if (context == null) {
            r.a(SpeechConstant.NET_TYPE, "none", false);
        } else {
            NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
            if (activeNetworkInfo == null) {
                r.a(SpeechConstant.NET_TYPE, "none", false);
                return;
            }
            r.a(SpeechConstant.NET_TYPE, M.a(activeNetworkInfo), false);
            r.a("net_subtype", R.f(M.b(activeNetworkInfo)), false);
        }
    }

    private static void a(R r) {
        if (r != null && Setting.getLogLevel() != Setting.LOG_LEVEL.none) {
            String logPath = Setting.getLogPath();
            if (TextUtils.isEmpty(logPath)) {
                logPath = "/sdcard/msc/msc.log";
            }
            int i = -1;
            if (Setting.getLogLevel() == Setting.LOG_LEVEL.detail) {
                i = 31;
            } else if (Setting.getLogLevel() == Setting.LOG_LEVEL.normal) {
                i = 15;
            } else if (Setting.getLogLevel() == Setting.LOG_LEVEL.low) {
                i = 7;
            }
            I.b(logPath);
            r.a("log", logPath);
            r.a("lvl", new StringBuilder().append(i).toString());
            r.a("output", "1", false);
        }
    }

    public static boolean a(String str) {
        return str != null && (str.contains("sms") || str.contains("iat"));
    }

    public static int b(AbstractHandlerC0273s sVar) {
        if (sVar == null || !sVar.m()) {
            return AudioDetector.DEF_EOS;
        }
        return 1800;
    }

    public static String b(Context context, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        a(context, b2);
        b(context, b2);
        b2.a(SpeechConstant.RESULT_TYPE, AdType.STATIC_NATIVE);
        b2.a("rse", sVar.s());
        b2.a(SpeechConstant.TEXT_ENCODING, sVar.r());
        b2.a("ssm", "1", false);
        b2.a(SpeechConstant.SUBJECT, SpeechConstant.ENG_IVP, false);
        int t = sVar.t();
        b2.a("auf=audio/L16;rate", Integer.toString(t), false);
        if (t == 16000) {
            b2.a("aue", "speex-wb;10", false);
        } else {
            b2.a("aue", "speex", false);
        }
        b2.a(SpeechConstant.VAD_BOS, "3000", false);
        b2.a(SpeechConstant.VAD_EOS, "700", false);
        b2.a(S.c);
        return b2.toString();
    }

    public static String b(Context context, String str, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        a(context, b2);
        b(context, b2);
        b2.a("sub", "mfv", false);
        b2.a("prot_ver", "50", false);
        b2.a("mver", "2.0", false);
        b2.a("server_url", "http://imfv.openspeech.cn/msp.do", false);
        if ("verify".equals(b2.e("sst"))) {
            b2.a("scene_mode", "vfy", false);
        } else {
            b2.a("scene_mode", "gen", false);
        }
        b2.a(S.c);
        return b2.toString();
    }

    public static void b(Context context, R r) {
        int lac;
        int i = 0;
        long elapsedRealtime = SystemClock.elapsedRealtime();
        if (context != null && E.b(context)) {
            try {
                TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
                int phoneType = telephonyManager.getPhoneType();
                String networkOperator = telephonyManager.getNetworkOperator();
                int parseInt = Integer.parseInt(networkOperator.substring(0, 3));
                int parseInt2 = Integer.parseInt(networkOperator.substring(3));
                switch (phoneType) {
                    case 1:
                        GsmCellLocation gsmCellLocation = (GsmCellLocation) telephonyManager.getCellLocation();
                        i = gsmCellLocation.getCid();
                        lac = gsmCellLocation.getLac();
                        break;
                    case 2:
                        CdmaCellLocation cdmaCellLocation = (CdmaCellLocation) telephonyManager.getCellLocation();
                        i = cdmaCellLocation.getBaseStationId();
                        lac = cdmaCellLocation.getNetworkId();
                        break;
                    default:
                        lac = 0;
                        break;
                }
                r.a("mmlc", parseInt + "|" + parseInt2 + "|" + lac + "|" + i);
                O.d("MCC = " + parseInt + "\t MNC = " + parseInt2 + "\t phoneType = " + phoneType + "\t LAC = " + lac + "\t CID = " + i);
            } catch (Exception e) {
                O.d("get mmlc failed");
            }
            O.d("get mmlc time cost:" + (SystemClock.elapsedRealtime() - elapsedRealtime));
        }
    }

    private static void b(R r) {
        SpeechUtility utility = SpeechUtility.getUtility();
        if (utility != null) {
            String parameter = utility.getParameter("ver_tts");
            if (!r.g("speed_increase")) {
                int a2 = r.a(SpeechConstant.SPEED, 50);
                if (a2 <= 100) {
                    r.a(SpeechConstant.SPEED, new StringBuilder().append(a2).toString());
                    r.a("speed_increase", "1");
                } else if (100 < a2 && a2 <= 150 && (TextUtils.isEmpty(parameter) || parameter.contains("5.5."))) {
                    r.a(SpeechConstant.SPEED, new StringBuilder().append(a2 - 50).toString());
                    r.a("speed_increase", "2");
                } else if (100 < a2 && a2 <= 200) {
                    r.a(SpeechConstant.SPEED, new StringBuilder().append(a2 - 100).toString());
                    r.a("speed_increase", "4");
                }
            }
        }
    }

    public static String c(Context context, R r) {
        R b2 = r.clone();
        SpeechUtility utility = SpeechUtility.getUtility();
        if (utility != null) {
            b2.a("appid", utility.getParameter("appid"));
        }
        b2.a(D.b(context));
        b2.a("dvc", a(context), false);
        b2.a("aue", "raw", false);
        b2.a(S.c);
        return b2.toString();
    }

    public static String c(Context context, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        a(context, b2);
        b(context, b2);
        b2.a("ssm", "1", false);
        b2.a(SpeechConstant.RESULT_TYPE, AdType.STATIC_NATIVE, false);
        b2.a("rse", sVar.s(), false);
        b2.a(SpeechConstant.TEXT_ENCODING, sVar.r(), false);
        b2.a(S.c);
        return b2.toString();
    }

    public static String d(Context context, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        a(context, b2);
        b(context, b2);
        b2.a("ssm", "1", false);
        int t = sVar.t();
        b2.a("auf=audio/L16;rate", Integer.toString(t));
        if (t == 16000) {
            b2.a("aue", "speex-wb", false);
        } else {
            b2.a("aue", "speex", false);
        }
        b2.a(SpeechConstant.VOICE_NAME, b2.b(SpeechConstant.VOICE_NAME, a), true);
        b2.a(SpeechConstant.TEXT_ENCODING, sVar.r(), false);
        b(b2);
        b2.a(S.c);
        return b2.toString();
    }

    public static String e(Context context, AbstractHandlerC0273s sVar) {
        R b2 = sVar.x().clone();
        a(context, b2);
        b(context, b2);
        b2.a("ssm", "1", false);
        int t = sVar.t();
        b2.a("auf=audio/L16;rate", Integer.toString(t), false);
        if (t == 16000) {
            b2.a("aue", "speex-wb", false);
        } else {
            b2.a("aue", "speex", false);
        }
        b2.a(SpeechConstant.TEXT_ENCODING, sVar.r(), false);
        b2.a("plev", "1", false);
        b2.a(SpeechConstant.ACCENT, "mandarin", false);
        b2.a(SpeechConstant.DOMAIN, "ise", false);
        b2.a(SpeechConstant.SUBJECT, "ise", false);
        b2.a(SpeechConstant.RESULT_TYPE, "xml", false);
        b2.a(SpeechConstant.VAD_BOS, "5000", false);
        b2.a(SpeechConstant.VAD_EOS, "1800", false);
        b2.a("vad_speech_timeout", "2147483647", false);
        b2.a(S.c);
        return b2.toString();
    }
}